package cn.hp.cms.utils;

import java.util.List;

// 分页的工具类
public class PageData {

    private int page ; // 当前页数
    private int totalCount  ; // 总条数
    private int limit ; //每页条数
    private int totalPages ;  // 总页数
    private List<?> data ; // 每页数据


    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getTotalPages() {
        return totalPages;
    }

//    在设置完总条数 以及每页条数之后，直接可以获取
    public void setTotalPages() {
//        28 / 10 = 2 + 1 = 3
//        20 / 10 = 2
        if (totalCount%limit == 0 ){
            totalPages = totalCount/limit;
        }else {
            totalPages = totalCount/limit + 1 ;
        }
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public List<?> getData() {
        return data;
    }

    public void setData(List<?> data) {
        this.data = data;
    }
}
